package com.wframe.project.jnd.services;

import com.frame.database.JdataBean;
import com.frame.database.PageResult;
import com.wframe.project.jnd.entity.BuySendPromotion;
import com.wframe.project.jnd.entity.FlashSalePromotion;
import com.wframe.project.jnd.entity.Promotion;
import com.wframe.project.jnd.vo.ActiveAreaProduct;
import com.wframe.project.jnd.vo.CartItem;
import com.wframe.project.jnd.vo.CartProductVO;
import com.wframe.project.jnd.vo.Product;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

/**
 * Created by lwb on 2017/6/3.
 */
public interface PromotionService {
    /**
     * 单品促销信息
     *
     * @param promotionId
     * @return
     * @throws Exception
     */
    Promotion findFlashSale(String promotionId) throws Exception;

    /**
     * 买送促销信息
     *
     * @param promotionId
     * @return
     * @throws Exception
     */
    Promotion findBuySend(String promotionId) throws Exception;

    /**
     * 满减促销信息
     *
     * @param promotionId
     * @return
     */
    Promotion findMoneyOff(String promotionId);

    /**
     * 满赠促销信息
     *
     * @param promotionId
     * @return
     */
    Promotion findPurchaseGift(String promotionId);

    /**
     * 单品促销信息
     *
     * @param productid
     * @param userid
     * @return
     * @throws Exception
     */
    JdataBean findFlashSaleByProductId(String productid, String userid, int platform);

    /**
     * 买送促销信息
     *
     * @param productid
     * @param userid
     * @return
     * @throws Exception
     */
    JdataBean findBuySendByProductId(String productid, String userid);

    /**
     * 是否促销商品次数限制
     *
     * @param buyNum
     * @param userid
     * @return
     */
    boolean isTimeLimit(int buyNum, String userid, String promotionid);

    Integer getResidualNumber(String userid, String promotionid);

    /**
     * 查询正在进行当中的单品促销列表
     *
     * @param platform
     * @param pagesize
     * @param pageno
     * @return
     */
    PageResult findOnFlashSaleByPlatform(int platform, Long uid, int pagesize, int pageno);

    /**
     * 校验促销商品库存
     *
     * @param promotionId
     * @return
     */
    boolean checkInventory(String promotionId);

    List<JdataBean> findByIds(String[] ids);

    List<ActiveAreaProduct> findOnSalePromotions(Promotion.Type type, int platform, int weight, long number, TimeUnit unit, String userid);

    Map<String, String> findAll(String productid, String userid, int platform);

    Promotion findFlashSale(String userid, String promotionid);

    List<JdataBean> findAll(String userid, Set<String> ids, int platform);

    List<FlashSalePromotion> findFlashSale(String userid, Set<String> ids, int platform);

    List<BuySendPromotion> findBuySend(String userid, Set<String> ids);

    List<JdataBean> findSpecificPromotions(String userid, Set<Integer> ids, int platform);
}
